# Contributor: ScrumpyJack <scrumpyjack@st.ilet.to>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=rawtherapee
pkgver=5.8
pkgrel=0
pkgdesc="Powerful cross-platform raw image processing program"
url="https://rawtherapee.com"
arch="all !s390x !mips !mips64" # Limited by librsvg which in turn is limited by rust
license="GPL-3.0-or-later"
makedepends="bzip2-dev cmake exiv2-dev expat-dev fftw-dev glib-dev gtk+3.0-dev
	gtk-engines-dev gtkmm3-dev lcms2-dev lensfun-dev libcanberra-dev
	libiptcdata-dev libjpeg-turbo-dev libpng-dev librsvg-dev libsigc++-dev
	mercurial tiff-dev zlib-dev"
options="!check !strip"
subpackages="$pkgname-doc $pkgname-dbg"
source="https://rawtherapee.com/shared/source/rawtherapee-$pkgver.tar.xz"

prepare() {
	default_prepare
	mkdir -p "$builddir"/build
	cd "$builddir"/build
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS -std=c++11" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} ..
}

build() {
	cd "$builddir"/build
	make
}

package() {
	cd "$builddir"/build
	make DESTDIR="$pkgdir" install
}

sha512sums="bc79586cd937dcaefc053e65faa2162de887d514e44980956d937c157c6d55c4f6e6a7a9b8f91f2d657ed2054814737b96d5d741674c1e5a961d7177433efe4e  rawtherapee-5.8.tar.xz"
